Tutorial

Perl for Generation of HTML

Scalar Operators

Comparison Operators

Numeric test

==
Equal to
!=
Not equal to
>
Greater than
>=
Greater than or equal to
<
Less than
<=
Less than or equal to
<=>
Not equal to with signed return

String test

eq
Equal to
ne
Not equal to
gt
Greater than
ge
Greater than or equal to
lt
Less than
le
Less than or equal to
cmp
Not equal to with signed return

Pattern Matching

$a =~ /pat/
Match
$a =~ s/p/r/
Substitution
$a =~ tr/p/r/
Translation

Logical Operators

$a && $b
And
$a || $b
Or
! $a
Not

Arithmetic Operators

$a + $b
Add
$a - $b
Subtract
$a * $b
Multiply
$a / $b
Divide
$a % $b
Modulus
$a ** $b
Exponentiate
$a++ , ++$a
Autoincrement
$a-- , --$a
Autodecrement

String Operators

$a . $b
Concatenation
$a x $b
Repeat
substr($a,$o,$l)
Substring
index($a,$b)
Index

Assignment Operators

$a = $b
Assign
$a += $b
Add to
$a -= $b
Subtract from
$a .= $b
Append

File Operators

-r $a
Readable
-w $a
Writable
-d $a
Directory
-f $a
Regular file
-T $a
Text file